home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / Source / MSG Demo 1.4.source Folder / Demo ƒ / Fades reversed ƒ / Quadrant fade reversed.c < prev    next >
Text File  |  1994-04-15  |  3KB  |  88 lines

  1. /**********************************************************************\
  2.  
  3. File:        Quadrant fade reversed.c
  4.  
  5. Purpose:    Graphic effect from offscreen bitmap to main window (on
  6.             screen).  See comments below for more description.
  7.  
  8. This program is free software; you can redistribute it and/or modify
  9. it under the terms of the GNU General Public License as published by
  10. the Free Software Foundation; either version 2 of the License, or
  11. (at your option) any later version.
  12.  
  13. This program is distributed in the hope that it will be useful,
  14. but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. GNU General Public License for more details.
  17.  
  18. You should have received a copy of the GNU General Public License
  19. along with this program in a file named "GNU General Public License".
  20. If not, write to the Free Software Foundation, 675 Mass Ave,
  21. Cambridge, MA 02139, USA.
  22.  
  23. \**********************************************************************/
  24.  
  25. #include "timing.h"
  26.  
  27. #define CorrectTime 3
  28. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  29. #define theWindowWidth (boundsRect.right-boundsRect.left)
  30. #define NUM_ITERATIONS    25
  31.  
  32. pascal short QuadrantFadeReversed(Rect boundsRect, Pattern *thePattern);
  33.  
  34. /* 4 regions, splitting the screen into 4 quadrants.  Wipe the screen right in
  35.    the top-left quadrant, down in the top-right, left in the bottom-right,
  36.    up in the bottom-left. */
  37.    
  38. pascal short QuadrantFadeReversed(Rect boundsRect, Pattern *thePattern)
  39. {
  40.     int            x;
  41.     Rect        tldest, trdest, bldest, brdest;
  42.     Rect        tlbounds, trbounds, blbounds, brbounds;
  43.     int            cx,cy;
  44.     int            BoxSize, HBoxSize;
  45.     
  46.     BoxSize=theWindowHeight/(NUM_ITERATIONS*2);
  47.     HBoxSize=theWindowWidth/(NUM_ITERATIONS*2);
  48.     
  49.     cx = boundsRect.left + theWindowWidth / 2;
  50.     cy = boundsRect.top + theWindowHeight / 2;
  51.     
  52.     tlbounds=trbounds=blbounds=brbounds=tldest=trdest=bldest=brdest=boundsRect;
  53.     tlbounds.right=trbounds.left=blbounds.right=brbounds.left=
  54.         tldest.right=trdest.left=bldest.right=brdest.left=cx;
  55.     tlbounds.bottom=trbounds.bottom=blbounds.top=brbounds.top=
  56.         tldest.bottom=trdest.bottom=bldest.top=brdest.top=cy;
  57.     brdest.right=brdest.left+HBoxSize;
  58.     bldest.bottom=bldest.top+BoxSize;
  59.     tldest.left=tldest.right-HBoxSize;
  60.     trdest.top=trdest.bottom-BoxSize;
  61.     
  62.     for (x=0; x<NUM_ITERATIONS; x++)
  63.     {
  64.         StartTiming();
  65.         FillRect(&brdest, *thePattern);
  66.         brdest.left+=HBoxSize;
  67.         brdest.right+=HBoxSize;
  68.         
  69.         FillRect(&bldest, *thePattern);
  70.         bldest.top+=BoxSize;
  71.         bldest.bottom+=BoxSize;
  72.         
  73.         FillRect(&tldest, *thePattern);
  74.         tldest.left-=HBoxSize;
  75.         tldest.right-=HBoxSize;
  76.         
  77.         FillRect(&trdest, *thePattern);
  78.         trdest.top-=BoxSize;
  79.         trdest.bottom-=BoxSize;
  80.         
  81.         TimeCorrection(CorrectTime);
  82.     }
  83.     
  84.     FillRect(&boundsRect, *thePattern);        /* in case we miss a few pixels */
  85.     
  86.     return 0;
  87. }
  88.